/*
 * ResourceProducerUnitVisitor.cpp
 *
 *  Created on: Nov 16, 2008
 *      Author: Ryan
 */

#include "ResourceProducerUnitVisitor.h"

#include "../../../OOInterface/Objects/Logger.h"

#include "../../../OOInterface/Objects/Units/UnitAspects/ResourceExtractorAspect.h"

ResourceProducerUnitVisitor::ResourceProducerUnitVisitor( const OOInterface::Resource& r, const OOInterface::ResourceList& list, const OOInterface::GameMap& map, const OOInterface::Point3f& loc ) :
	_resource( r ), _resourceList( list ), _location( loc ), _map( map )
{
}

ResourceProducerUnitVisitor::~ResourceProducerUnitVisitor()
{
}

void ResourceProducerUnitVisitor::visitUnit( const OOInterface::Unit& u )
{
	for( OOInterface::ResourceList::const_iterator it = _resourceList.begin(); it != _resourceList.end(); ++it )
	{
		_rating -= 0.01f * u.getResourceCost( *it );
		_rating -= 0.01f * u.getResourceUpkeep( *it );

		_rating += 0.01f * u.getResourceGeneration( *it );
		_rating += 0.01f * u.getResourceStorage( *it );
	}

}

void ResourceProducerUnitVisitor::visitAirAspect( const OOInterface::AirAspect& a )
{
}

void ResourceProducerUnitVisitor::visitLandAspect( const OOInterface::LandAspect& a )
{
}

void ResourceProducerUnitVisitor::visitWaterAspect( const OOInterface::WaterAspect& a )
{
}

void ResourceProducerUnitVisitor::visitBuilderAspect( const OOInterface::BuilderAspect& a )
{
}

void ResourceProducerUnitVisitor::visitBuildingAspect( const OOInterface::BuildingAspect& a )
{
}

void ResourceProducerUnitVisitor::visitTransportAspect( const OOInterface::TransportAspect& a )
{
}


void ResourceProducerUnitVisitor::visitReclaimableAspect( const OOInterface::ReclaimableAspect& a )
{
}

void ResourceProducerUnitVisitor::visitResourceExtractorAspect( const OOInterface::ResourceExtractorAspect& a )
{
	_rating += a.getAmountGenerated( _resource, _map, _location );
}
